/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package proyectoso;

/**
 *
 * @author Christian
 */
public class Arena {
    int ArenaOahu;
    int ArenaOahuAdultos;
    int ArenaOahuChildren;
    int ArenaMolokai;
    int ArenaMolokaiAdultos;
    int ArenaMolokaiChildren;
    Arena(){
        this.ArenaMolokai=0;
        this.ArenaOahu=0;
        this.ArenaMolokaiAdultos=0;
        this.ArenaMolokaiChildren=0;
        this.ArenaOahuAdultos=0;
        this.ArenaOahuChildren=0;
    }
    public synchronized void Escribir(int is, int pe){
        if (is==0 && pe==0){
            ArenaOahu++;
            ArenaOahuChildren++;
        }
        else{
            if(is==0 && pe==1){
                ArenaOahu++;
                ArenaOahuAdultos++;
            }
        }
        if (is==1 && pe==0){
            ArenaMolokai++;
            ArenaMolokaiChildren++;
        }
        else{
            if(is==1 && pe==1){
                ArenaMolokai++;
                ArenaMolokaiAdultos++;
            }
        }
    }
    public synchronized void Borrar(int is, int pe){
        if (is==0 && pe==0){
            ArenaOahu--;
            ArenaOahuChildren--;
        }
        else{
            if(is==0 && pe==1){
                ArenaOahu--;
                ArenaOahuAdultos--;
            }
        }
        if (is==1 && pe==0){
            ArenaMolokai--;
            ArenaMolokaiChildren--;
        }
        else{
            if(is==1 && pe==1){
                ArenaMolokai--;
                ArenaMolokaiAdultos--;
            }
        }
    }
    public synchronized int GetPeople(int is){
        if (is==0)
            return ArenaOahu;
        else
            return ArenaMolokai;
    }
    public synchronized int GetChildren(int is){
        if (is==0)
            return ArenaOahuChildren;
        else
            return ArenaMolokaiChildren;
    }
    public synchronized int GetAdultos(int is){
        if (is==0)
            return ArenaOahuAdultos;
        else
            return ArenaMolokaiAdultos;
    }
    public synchronized void Wait(){
        try{
            wait();
        }
        catch(Exception e){
            
        }
    }
    public synchronized void NotifyAll(){
        notifyAll();
    }
}